package com.tenglong.teacher.ui.homework;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.tenglong.teacher.R;


/**
 * Created by Kevin on 2017/12/28.
 */

public class DeleteSubmitHomeworkDialog extends Dialog implements View.OnClickListener{
    private TextView submitTxt;
    private TextView cancelTxt;
    private Context mContext;
    private OnDelListener mListener;
    private int mPos;


    public DeleteSubmitHomeworkDialog(Context context, OnDelListener l, int pos) {
        super(context);
        this.mContext = context;
        mListener=l;
        mPos=pos;
    }



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_del_hw);
        setCanceledOnTouchOutside(false);
        initView();
    }

    private void initView(){
        submitTxt = findViewById(R.id.submit);
        submitTxt.setOnClickListener(this);
        cancelTxt = findViewById(R.id.cancel);
        cancelTxt.setOnClickListener(this);


    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.cancel:

                this.dismiss();
                break;
            case R.id.submit:
                mListener.onDelClick(this,true,mPos);
                this.dismiss();
                break;
             default:

        }
    }
    public interface OnDelListener{
        void onDelClick(Dialog dialog, boolean confirm, int pos);
    }

}
